<template lang="jade">
h-loader-full(url='loader',:setdata='false')
  h-data-lister(data='list')

  m-title(icon="add",name="已发布兼职列表")
  //-   label 开始时间
  //-   input(type='datetime-local', v-model="start_time")
  //-   label 结束时间
  //-   input(type='datetime-local', v-model="end_time")
  //-   button(@click='filter_time') 过滤
  .box
    //人员信息
    table.list
      ml-header(data='兼职名称,联系电话,兼职所在地,兼职详细地址,兼职内容,发布时间,备注,是否发布,操作')
      tr
        td 
          input(type = 'text', style="width:60px", v-model="search.job_name") 
        td 
          input(type = 'text', style="width:60px", v-model="search.mobile") 
        td 
          input(type = 'text', style="width:60px", v-model="search.address") 
        td 
          input(type = 'text', style="width:60px", v-model="search.address_detail") 
        td 
          input(type = 'text', style="width:60px", v-model="search.job_content") 
        td 
        td 
        td 
        td 
        td 
          button(@click='searchdo(search)') 搜索




      tr(v-for='(n,i) in list')
        td {{n.job_name}}
        td {{n.mobile}}
        td {{n.address}}
        td {{n.address_detail}}
        td {{n.job_content}}
        td {{new Date(n.time_start * 1000).format('yyyy-MM-dd hh:mm:ss') }}
        td
        td: input(type='text',v-model='n.remark')
        td: input(type='checkbox',v-model='n.status')
        td
          a(href='javascript:void(0)',@click='check(n)') 更新
          
          
    .command
      .page
        button(v-show='page>1', @click="pagego('last')") 上一页
        button {{page}}
        button(@click="pagego('next')") 下一页
            &nbsp;&nbsp;&nbsp;&nbsp;统计共有{{count_num}}条记录
</template>
<style>
  #title .filter{ padding-top: 0; }
</style>
<script>
import { MessageBox } from 'mint-ui'
export default {
	data () {
		return {
			loader:{
        list:'part/time/list?page=1&job_name=&mobile=&address=&address_detail=&job_content=&num=15&status=0'
        },
      list:[],
      page:1,
      count_num:0,
      start_time:"",
      end_time:"",
      search:{
        job_name:'',
        mobile:'',
        address:'',
        address_detail:'',
        job_content:'',
      }
		}
	},
  mounted () {
    this.getcount()
  },
  watch:{
    list:function(){
    }
  },
	methods: {
		loadAfter(data){
      this.list=data.list
		},
    // download(){
    //   	window.location.href = 'http://xiongan.manager.hesq.com.cn/rest/get/excel/jobseeker/info'
    //     // window.location.href = 'http://127.0.0.1:5110/rest/get/excel/jobseeker/info'
    // },



    // filter_time(){
    //   var start_time = this.start_time;
    //   var end_time = this.end_time;
    //   this.$ajax.get('get/jobseeker/info?&page=1&start_time='+start_time+"&end_time="+end_time+
    //     '&username='+search.username+
    //     '&mobile='+search.mobile+
    //     '&sex='+search.sex+
    //     '&age='+search.age+
    //     '&intention='+search.intention+
    //     '&area='+search.area
    //   , (res) => {
    //     this.list = res.data
    //   }, (res) => {
    //     this.error(res.message)
    //   })
    //   this.getcount();
    // },

    //更改状态
    check(obj){
      this.$ajax.put('update/part/time',{'id':obj.id,'status':obj.status,'remark':obj.remark},(res)=>{
        this.$msg.success('更新成功')
        setTimeout('window.location.reload()',1500)
      },(res)=>{
        // this.$msg.error('更新失败')
      })
    },


    //删除
    deletethe(obj){

    },

    //获取总条数
    getcount(){
      this.$ajax.get('get/part/time/count?status=0', (res) => {
        this.count_num = res.data[0].countnum
      }, (res) => {
        this.error(res.message)
      })
    },


    pagego (type) {
      var search = this.search;
      this.page = type == 'last' ? this.page - 1 : this.page + 1
      this.$ajax.get('part/time/list?&page=' + this.page +"&num=15&status=0"+
        '&job_name='+search.job_name+
        '&mobile='+search.mobile+
        "&address="+search.address+
        "&address_detail="+search.address_detail+
        "&job_content="+search.job_content
      , (res) => {
        this.list = res.data
      }, (res) => {
        this.error(res.message)
      })
    },



    searchdo(search){
      this.$ajax.get('part/time/list?&page=' + this.page +"&num=15&status=0"+
        '&job_name='+search.job_name+
        '&mobile='+search.mobile+
        "&address="+search.address+
        "&address_detail="+search.address_detail+
        "&job_content="+search.job_content
      , (res) => {
        this.list = res.data
      }, (res) => {
        this.error(res.message)
      })
    }
	}
}
</script>
<style>
  .button{background: #ff5700; padding: 2%; color: #fff; text-decoration-line: none;}
</style>
